package com.xdtech.game.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.game.model.Rank;
import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-03-16 23:21:56
 * @since 1.0
 * @see
 */
public class RankItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="分数",width=100)
	private Integer score;
	@GridColumn(title="用户名",width=100)
	private String uname;
	@GridColumn(title="用户id",width=100)
	private String uid;
	@GridColumn(title="设备类型",width=100)
	private String deviceType;
	@GridColumn(title="游戏类型编号",width=100)
	private String gameCode;

	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	public void setScore(Integer score) {
		this.score = score;
	}
	public Integer getScore() {
		return score;
	}
	
	public void setUid(String uid) {
		this.uid = uid;
	}
	public String getUid() {
		return uid;
	}
	
	public void setDeviceType(String deviceType) {
		this.deviceType = deviceType;
	}
	public String getDeviceType() {
		return deviceType;
	}
	
	public void setGameCode(String gameCode) {
		this.gameCode = gameCode;
	}
	public String getGameCode() {
		return gameCode;
	}
	public String getUname() {
		return uname;
	}
	public void setUname(String uname) {
		this.uname = uname;
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static RankItem createItem(Rank rank) {
		RankItem rankItem = new RankItem();
		BeanUtils.copyProperties(rankItem, rank);
		//自定义属性设置填充
		return rankItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<RankItem> createItems(List<Rank> ranks) {
		List<RankItem> rankItems = new ArrayList<RankItem>();
		for (Rank rank : ranks) {
			rankItems.add(createItem(rank));
		}
		return rankItems;
	}
}
